package com.qige.homework;

public class homework3 {
    public static void main(String[] args) {
        Person1[] p = new Person1[3];
        p[0] = new Chinese();
        p[1] = new American();
        p[2] = new Indian();
        for (int i = 0; i < p.length; i++) {
            p[i].eat();
        }
    }
}
abstract class Person1{
    public abstract void eat();
}
class Chinese extends Person1{
    public void eat(){
        System.out.println("用筷子吃饭");
    }
}
class American extends Person1{
    public void eat(){
        System.out.println("用刀叉吃饭");
    }
}
class Indian extends Person1{
    public void eat(){
        System.out.println("用手抓饭");
    }
}
